package com.wjh.controller;


import com.wjh.pojo.LogisticsStaff;
import com.wjh.service.LogisticsStaffService;
import com.wjh.utils.ResponseResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Random;

@RestController
@RequestMapping("staff")
public class LogisticsStaffController {

    @Resource
    private LogisticsStaffService logisticsStaffService;

    @GetMapping("/list")
    public ResponseResult queryAll(Integer pageNum, Integer pageSize,
                                   String name, String phone){
        return logisticsStaffService.queryAll(pageNum,pageSize,name,phone);
    }

    @PutMapping("/update")
    public ResponseResult updateStaff(@RequestBody LogisticsStaff logisticsStaff){
        return logisticsStaffService.updateStaff(logisticsStaff);
    }

    @DeleteMapping("/del/{id}")
    public ResponseResult delByIds(@PathVariable("id") List<Integer> id){
        return logisticsStaffService.delByIds(id);
    }

    @PostMapping("/add")
    public ResponseResult addStaff(@RequestBody LogisticsStaff logisticsStaff){
        return logisticsStaffService.addStaff(logisticsStaff);
    }
}

